﻿@{
    ViewBag.Title = "cc";
    Layout = "~/Views/Shared/ShouYe.cshtml";
}
<script src="~/BootstrapSouce/js/jquery.min.js"></script>
<link href="~/BootstrapSouce/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/BootstrapSouce/js/bootstrap.min.js"></script>
<div>
    <table class="table">
        按姓名查找：
        <tr><td> 姓名:<input id="Staff_Name" type="text" name="Staff_Name" />&nbsp;&nbsp;&nbsp;&nbsp;<input id="Button1" type="button" value="查询" onclick="Name()" /></td></tr>
        
    </table>


    <table class="table">
        按年龄查找：
        <tr><td>年龄:<input id="Staff_Age" type="text" name="Staff_Age" style="width:65px" />至<input id="Staff_Age1" type="text" name="Staff_Age" style="width:65px"  />&nbsp;&nbsp;&nbsp;&nbsp;<input id="Button1" type="button" value="查询" onclick="Age()" /></td></tr>
    </table>

    <table class="table">
        按工资查询：
        <tr><td>工资:<input id="Money" type="text" name="Money" style="width:65px" />至<input id="Money1" type="text" name="Money1" style="width:65px" />&nbsp;&nbsp;&nbsp;&nbsp;<input id="Button1" type="button" value="查询" onclick="Money()" /></td></tr>
    </table>
    <table class="table">
        按部门查询：
        <tr><td>部门:<select id="BuMen" name="BuMen"><option value="技术部">技术部</option><option value="市场部">市场部</option><option value="前台">前台</option><option value="销售部">销售部</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input id="Button1" type="button" value="查询" onclick="BuMen()" /></td></tr>
    </table>
    <table class="table">
        <tr><td><input id="Sex" type="button" value="查询所有男员工" onclick="Nan()" /></td><td><input id="Button1" type="button" value="查询所有女员工" onclick="NV()" /></tr>
    </table>
</div>
<div>
    
    <table class="table">
       <thead>
           <tr>
               <td>编号</td>
               <td>姓名</td>
               <td>年龄</td>
               <td>性别</td>
               <td>住址</td>
               <td>基本工资</td>
               <td>工龄</td>
               <td>入职时间</td>
               <td>是否培训</td>
               <td>所在部门</td>
               <td>是否在职</td>
               <td>技能特长</td>
               <td>本人照片</td>
               
           </tr>     
       </thead>
             <tbody id="tbo">

             </tbody>
    </table>

</div>

<script>
    function BuMen() {
        var BuMen = $("#BuMen").val();
       
        $.ajax({
            type: "post",
            url: "/XBK/SSS",
            dataType:"JSON",
            data:{BuMen:BuMen},
            success: function (obj)
            {
                $("#tbo").empty();

                for (var i = 0; i <obj.length; i++)
                {


                    var strhtml = "<tr>";
                    strhtml += "<td >" + obj[i].Staff_ID + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Name + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Age + "</td>";
                    if (obj[i].Staff_Sex == 0) {
                        strhtml += "<td>男</td>"
                    }
                    else { strhtml += "<td>女</td>" }
                    strhtml += "<td>" + obj[i].Staff_Address + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Money + "</td>";
                    strhtml += "<td>" + obj[i].Staff_GL + "</td>";
                    strhtml += "<td>" + obj[i].Hiredate + "</td>";

                    if (obj[i].Train == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else {
                        strhtml += "<td>否</td>"
                    }
                    strhtml += "<td>" + obj[i].BuMen + "</td>";
                    if (obj[i].RenyuanZT == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else { strhtml += "<td>否</td>"}
                    strhtml += "<td>" + obj[i].JishuTechang + "</td>";

                    strhtml += "<td><img src="+obj[i].Image_Url+" style='height:80px;width:80px' /></td>";

                    strhtml += "</tr>";

                    $("#tbo").append(strhtml);
                }






            }

        })
    }
    function Name() {
        var Name = $("#Staff_Name").val();
    
        $.ajax({
            type: "post",
            url: "/XBK/Name",
            dataType: "JSON",
            data: { Staff_Name:Name },
            success: function (obj) {      
                $("#tbo").empty();
                
                for (var i = 0; i < obj.length; i++) {

                    
                    var strhtml = "<tr>";
                    strhtml += "<td >" + obj[i].Staff_ID + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Name + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Age + "</td>";
                    if (obj[i].Staff_Sex == 0) {
                        strhtml += "<td>男</td>"
                    }
                    else { strhtml += "<td>女</td>" }
                    strhtml += "<td>" + obj[i].Staff_Address + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Money + "</td>";
                    strhtml += "<td>" + obj[i].Staff_GL + "</td>";
                    strhtml += "<td>" + obj[i].Hiredate + "</td>";

                    if (obj[i].Train == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else {
                        strhtml += "<td>否</td>"
                    }
                    strhtml += "<td>" + obj[i].BuMen + "</td>";
                    if (obj[i].RenyuanZT == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else { strhtml += "<td>否</td>" }
                    strhtml += "<td>" + obj[i].JishuTechang + "</td>";

                    strhtml += "<td><img src=" + obj[i].Image_Url + " style='height:80px;width:80px' /></td>";

                    strhtml += "</tr>";

                    $("#tbo").append(strhtml);
                }






            }

        })
    }
    function Age() {
        var Age = $("#Staff_Age").val();
        var age1 = $("#Staff_Age1").val();
        $.ajax({
            type: "post",
            url:"/XBK/Ages",
            dataType: "JSON",
            data: { Age: Age, age1: age1 },
            success: function (obj) {
               
                $("#tbo").empty();

                for (var i = 0; i < obj.length; i++) {


                    var strhtml = "<tr>";
                    strhtml += "<td >" + obj[i].Staff_ID + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Name + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Age + "</td>";
                    if (obj[i].Staff_Sex == 0) {
                        strhtml += "<td>男</td>"
                    }
                    else { strhtml += "<td>女</td>" }
                    strhtml += "<td>" + obj[i].Staff_Address + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Money + "</td>";
                    strhtml += "<td>" + obj[i].Staff_GL + "</td>";
                    strhtml += "<td>" + obj[i].Hiredate + "</td>";

                    if (obj[i].Train == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else {
                        strhtml += "<td>否</td>"
                    }
                    strhtml += "<td>" + obj[i].BuMen + "</td>";
                    if (obj[i].RenyuanZT == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else { strhtml += "<td>否</td>" }
                    strhtml += "<td>" + obj[i].JishuTechang + "</td>";

                    strhtml += "<td><img src=" + obj[i].Image_Url + " style='height:80px;width:80px' /></td>";

                    strhtml += "</tr>";

                    $("#tbo").append(strhtml);
                }






            }

        })
    }
    function Money() {
        var Money = $("#Money").val();
        var Money1 = $("#Money1").val();
        alert(Money);
        $.ajax({
            type: "post",
            url: "/XBK/Money",
            dataType: "JSON",
            data: { Money: Money, Money1: Money1 },
            success: function (obj) {

                $("#tbo").empty();

                for (var i = 0; i < obj.length; i++) {


                    var strhtml = "<tr>";
                    strhtml += "<td >" + obj[i].Staff_ID + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Name + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Age + "</td>";
                    if (obj[i].Staff_Sex == 0) {
                        strhtml += "<td>男</td>"
                    }
                    else { strhtml += "<td>女</td>" }
                    strhtml += "<td>" + obj[i].Staff_Address + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Money + "</td>";
                    strhtml += "<td>" + obj[i].Staff_GL + "</td>";
                    strhtml += "<td>" + obj[i].Hiredate + "</td>";

                    if (obj[i].Train == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else {
                        strhtml += "<td>否</td>"
                    }
                    strhtml += "<td>" + obj[i].BuMen + "</td>";
                    if (obj[i].RenyuanZT == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else { strhtml += "<td>否</td>" }
                    strhtml += "<td>" + obj[i].JishuTechang + "</td>";

                    strhtml += "<td><img src=" + obj[i].Image_Url + " style='height:80px;width:80px' /></td>";

                    strhtml += "</tr>";

                    $("#tbo").append(strhtml);
                }






            }

        })
    }
    function Nan() {


        $.ajax({
            type: "post",
            url: "/XBK/Nan",
            dataType: "JSON",
           
            success: function (obj) {
                $("#tbo").empty();

                for (var i = 0; i < obj.length; i++) {


                    var strhtml = "<tr>";
                    strhtml += "<td >" + obj[i].Staff_ID + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Name + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Age + "</td>";
                    if (obj[i].Staff_Sex == 0) {
                        strhtml += "<td>男</td>"
                    }
                    else { strhtml += "<td>女</td>" }
                    strhtml += "<td>" + obj[i].Staff_Address + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Money + "</td>";
                    strhtml += "<td>" + obj[i].Staff_GL + "</td>";
                    strhtml += "<td>" + obj[i].Hiredate + "</td>";

                    if (obj[i].Train == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else {
                        strhtml += "<td>否</td>"
                    }
                    strhtml += "<td>" + obj[i].BuMen + "</td>";
                    if (obj[i].RenyuanZT == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else { strhtml += "<td>否</td>" }
                    strhtml += "<td>" + obj[i].JishuTechang + "</td>";

                    strhtml += "<td><img src=" + obj[i].Image_Url + " style='height:80px;width:80px' /></td>";

                    strhtml += "</tr>";

                    $("#tbo").append(strhtml);
                }






            }

        })
    }
    function NV() {


        $.ajax({
            type: "post",
            url: "/XBK/NV",
            dataType: "JSON",

            success: function (obj) {
                $("#tbo").empty();

                for (var i = 0; i < obj.length; i++) {


                    var strhtml = "<tr>";
                    strhtml += "<td >" + obj[i].Staff_ID + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Name + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Age + "</td>";
                    if (obj[i].Staff_Sex == 0) {
                        strhtml += "<td>男</td>"
                    }
                    else { strhtml += "<td>女</td>" }
                    strhtml += "<td>" + obj[i].Staff_Address + "</td>";
                    strhtml += "<td>" + obj[i].Staff_Money + "</td>";
                    strhtml += "<td>" + obj[i].Staff_GL + "</td>";
                    strhtml += "<td>" + obj[i].Hiredate + "</td>";

                    if (obj[i].Train == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else {
                        strhtml += "<td>否</td>"
                    }
                    strhtml += "<td>" + obj[i].BuMen + "</td>";
                    if (obj[i].RenyuanZT == 0) {
                        strhtml += "<td>是</td>"
                    }
                    else { strhtml += "<td>否</td>" }
                    strhtml += "<td>" + obj[i].JishuTechang + "</td>";

                    strhtml += "<td><img src=" + obj[i].Image_Url + " style='height:80px;width:80px' /></td>";

                    strhtml += "</tr>";

                    $("#tbo").append(strhtml);
                }






            }

        })
    }
</script>